﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>曲线柱形统计图表代码 - 源码之家</title>

<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript" src="jqplot.js"></script>
<script type="text/javascript">
<!--获取时间-->
  <!--num1-->
	    var myDate = new Date();
        var a=myDate.getFullYear();    //获取完整的年份(4位,1970-????)
        var b=myDate.getMonth()+1;       //获取当前月份(0-11,0代表1月)
        var c=myDate.getDate();        //获取当前日(1-31)
		//var c2=myDate.getDate()-1;
//		var c3=myDate.getDate()-2;
//		var c3=myDate.getDate()-3;
//		var c4=myDate.getDate()-4;
		var d=a+"/"+b+"/"+c;
//		var d2=a+"/"+b+"/"+c2;
//		var d3=a+"/"+b+"/"+c3;
//		var d4=a+"/"+b+"/"+c4;
		//alert(d)
		
		
$(document).ready(function() {
	var data = [[10.0, 9.8, 9.9, 10.5, 9.7, 8.9, 9.5, 10.2,10.0]];
	var data_max = 11; //Y轴最大刻度
	var line_title = ["新兴三黄鸡"]; //曲线名称
	var y_label = ""; //Y轴标题
	var x_label = ""; //X轴标题
	//var num1=d,num2=d2,num3=d3,num4=d4,num5=d,num6=d,num7=d,num8=d;
	//var num1=d,num2=d,num3=d,num4=d,num5=d,num6=d,num7=d,num8=d;
	
	
	var x = [getBeforeDate(8),getBeforeDate(7),getBeforeDate(6),getBeforeDate(5),getBeforeDate(4),getBeforeDate(3),getBeforeDate(2),getBeforeDate(1),getBeforeDate(0)]; //定义X轴刻度值;
//var x=new Array()
//	x[0]=num1;
//	x[1]=num2;
//	x[2]=num3;
//	x[3]=num4;
//	x[4]=num5;
//	x[5]=num6;
//	x[6]=num7;
//	x[7]=num8;
	 
	  //获得年月日
    function getBeforeDate(n){
      var n = n;
      var d = new Date();
      var year = d.getFullYear();
      var mon=d.getMonth()+1;
      var day=d.getDate();
      if(day <= n){
        if(mon>1) {
          mon=mon-1;
        }
        else {
          year = year-1;
          mon = 12;
        }
      }
      d.setDate(d.getDate()-n);
      year = d.getFullYear();
      mon=d.getMonth()+1;
      day=d.getDate();
      s = year+"-"+(mon<10?('0'+mon):mon)+"-"+(day<10?('0'+day):day);
      return s;
    }

	
	
	var title = "新兴三黄鸡"; //统计图标标题
	j.jqplot.diagram.base("chart1", data, line_title, "", x, x_label, y_label, data_max, 1);
	//j.jqplot.diagram.base("chart2", data, line_title, "这是统计标题", x, x_label, y_label, data_max, 2);
});
</script>

</head>
<body>

	<div id="chart1" style=" font-size:14PX !important;"></div>


</body>
</html>

